home *** CD-ROM | disk | FTP | other *** search
- Path: news.telepac.pt!usenet
- From: jcarlosr@mail.telepac.pt (J.Carlos)
- Newsgroups: comp.lang.c++
- Subject: Re: Life is strange, especially with Watcom
- Date: Tue, 06 Feb 1996 19:49:18 GMT
- Organization: telepac
- Message-ID: <4f8f1h$8a3@vivaldi.telepac.pt>
- References: <DLxtH3.AMA.0.-s@cs.vu.nl>
- NNTP-Posting-Host: alv1_p7.telepac.pt
- X-Newsreader: Forte Free Agent 1.0.82
-
- alverste@cs.vu.nl (Andre Versteeg) wrote:
- >I have trouble with the difference between C and C++ with Watcom 10.0:
- >I have a library with the following function in the .H header file:
- >int Setup(void)
- >With this library came a .C example file which used this function as follows:
- >int v;
- >v = Setup();
- >All compiles very well, until I changed the code to:
- >int v = Setup(); and changed the filename to .CPP
- >Now the compiler screams the following:
- >* Undefined reference: int near Setup(void)
- >Can somebody offer a solution ? I'm not allowed to change the library...
-
- The problem is that the compiler is searching for the function Setup
- as a C++ function (with name mangling), but Setup is a C function so
- you must change the declaration in the .H file to :
-
- extern "C" int Setup(void)
-
- Regards, J.Carlos
- jcarlosr@mail.telepac.pt
-
-
-